package net.wofly.cashier.reservation.service;

import net.wofly.cashier.reservation.domain.Reservation;
import net.wofly.common.persistence.PageWrapper;
import net.wofly.common.util.ReturnBean;

import java.util.List;

/**
 * @author lign
 * @version 1.0
 * @created 17-十月-2017 23:09:08
 */
public interface IReservationService {

	/**
	 * 增加或修改
	 *
	 * @param entity
	 * @return
	 */
	public Reservation save(Reservation entity);

	/**
	 * 删除
	 *
	 * @param entity
	 * @return
	 */
	public void delete(Reservation entity);

	/**
	 * 根据主键ID删除
	 *
	 * @param key
	 * @return
	 */
	public void delete(String key);

	/**
	 * 根据主键查询
	 *
	 * @param key
	 * @return
	 */
	public Reservation findOne(String key);

	public List<Reservation> save(List<Reservation> entityList) ;

	/**
	 * 新增预约
	 * <ul>
	 * 	<li>按预约日期及就餐类型自动增加预约顺序码</li>
	 * 	<li>验证userID用户权限</li>
	 * 	<li></li>
	 * </ul>
	 *
	 * @param reservation
	 */
	public ReturnBean<Reservation> addReservation(Reservation reservation);

	/**
	 * 取消预约
	 * <ul>
	 * 	<li>验证userID用户权限</li>
	 * </ul>
	 * <ul>
	 * 	<li>将状态置为预约取消</li>
	 * 	<li></li>
	 * </ul>
	 *
	 * @param reservationID
	 * @param userID
	 */
	public ReturnBean<String> cancelReservation(String reservationID, String employeeUserID);

	/**
	 * 分页获取所有预约
	 * <ul>
	 * 	<li>reservationMealTime=-1 && reservationMealType: =-1时，获取所有预约</li>
	 * 	<li>验证当前用户是否有权限操作</li>
	 * 	<li></li>
	 * </ul>
	 *
	 * @param employeeUserID
	 * @param reservationMealTime
	 * @param reservationMealType
	 */
	public ReturnBean<PageWrapper<Reservation>> getAllReservation(Integer pageNum, Integer pageSize, String employeeUserID, Long reservationMealTime, Integer reservationMealType);

	/**
	 * 就餐
	 * <ul>
	 * 	<li>修改预约状态</li>
	 * 	<li>同时，在订单表中增加一条点餐</li>
	 * 	<li>验证employeeUserID用户权限</li>
	 * 	<li></li>
	 * </ul>
	 *
	 * @param reservationID
	 * @param employeeUserID
	 */
	public ReturnBean<String> repast(String reservationID, String employeeUserID);

	/**
	 * 修改预约
	 * <ul>
	 * 	<li>按新预约日期及就餐类型自动增加预约顺序码</li>
	 * 	<li>原预约日期及就餐类型的预约顺序码放弃。</li>
	 * 	<li>验证employeeUserID用户权限</li>
	 * 	<li></li>
	 * </ul>
	 *
	 * @param reservation
	 */
	public ReturnBean<Reservation> updateReservation(Reservation reservation);
	
	Reservation findByTableIDAndStatusAndReservationMealTimeBetween(String tableID, Integer status, Long startTime, Long endTime);

}